using Entity;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace CardGameObject.CollectScene
{
    public class CollectCardDisplay : MonoBehaviour
    {
        public Canvas CardDisplay;
        public Image CardImage;
        public TextMeshProUGUI NameText;
        public TextMeshProUGUI AttackText;
        public TextMeshProUGUI HealthText;
        public TextMeshProUGUI CostText;
        public TextMeshProUGUI EffectText;
        
        private void Start()
        {
            CardDisplay.enabled = false;
        }

        public void SetCardInfo(Card card)
        {
            CardDisplay.enabled=true;
            AttackText.text = card.Attack.ToString();
            HealthText.text = card.Health.ToString();
            CostText.text = card.Cost.ToString();
            EffectText.text = card.EffectText;
            NameText.text = card.CardName;
            Sprite sprite = Resources.Load<Sprite>($"Images/CardImage/Content/{card.CardName}");

            if (sprite != null)
            {
                CardImage.sprite = sprite;
            }
        }
    }
}